using System;
using System.Collections.Generic;
using Admin.NET.Core;
using SqlSugar;

namespace Admin.NET.Application;

[SugarTable("PaymentRecord", "支付记录")]
[SysTable]
public class PaymentRecord : EntityTenant
{
	public string? ChannelId { get; set; }

	/// <summary>
	/// 商家订单号
	/// </summary>
	public string? OutTradeNo { get; set; }

	/// <summary>
	/// 支付名称
	/// </summary>
	public string PaymentName { get; set; }

	/// <summary>
	/// 区域id
	/// </summary>
	public long? BuildingId { get; set; }

	/// <summary>
	/// 房间id
	/// </summary>
	public long? RoomId { get; set; }

	/// <summary>
	/// 备注
	/// </summary>
	public string? Remark { get; set; }

	/// <summary>
	/// 金额
	/// </summary>
	[SugarColumn(Length = 28, DecimalDigits = 10)]
	public decimal Amount { get; set; }

	/// <summary>
	/// 服务费
	/// </summary>
	[SugarColumn(DefaultValue = "0", Length = 28, DecimalDigits = 10)]
	public decimal Rate { get; set; }

	/// <summary>
	/// 充值前的金额
	/// </summary>
	[SugarColumn(Length = 28, DecimalDigits = 10)]
	public decimal? BeforeAmount { get; set; }

	/// <summary>
	/// 操作人员姓名
	/// </summary>
	public new string CreateUserName { get; set; }

	/// <summary>
	/// 充值方式，0线下充值，1微信充值，2对公支付
	/// </summary>
	public PayTypeEnum PayType { get; set; }

	/// <summary>
	/// 是否支付（0：否，1：已支付，且已同步到房间余额，2：订单已关闭,3：支付成功，但未同步到房间,房间被删除）,4：退款（线下退款）
	/// </summary>
	public int IsPay { get; set; }

	/// <summary>
	/// 是否扣除余额，当退款时，需要选择是否扣款余额
	/// </summary>
	public bool? IsDeductBalance { get; set; }

	/// <summary>
	/// 是否赠送，false实际充值，true赠送
	/// </summary>
	public bool IsGiveAsAPresent { get; set; }

	/// <summary>
	/// 通知时间
	/// </summary>
	public DateTime? NotifyTime { get; set; }

	/// <summary>
	/// 标题
	/// </summary>
	public string? Subject { get; set; }

	/// <summary>
	/// 内容描述
	/// </summary>
	public string? Body { get; set; }

	/// <summary>
	/// 微信订单号
	/// </summary>
	public string? TradeNo { get; set; }

	/// <summary>
	/// 买家id
	/// </summary>
	public string? BuyerId { get; set; }

	/// <summary>
	/// 交易状态
	/// </summary>
	public string? TradeStatus { get; set; }

	/// <summary>
	/// 实收金额/实退金额
	/// </summary>
	[SugarColumn(Length = 28, DecimalDigits = 10)]
	public decimal? ReceiptAmount { get; set; }

	/// <summary>
	/// 付款金额
	/// </summary>
	public string? BuyerPayAmount { get; set; }

	/// <summary>
	/// 是否开票 0否，1已开票,2：开票中
	/// </summary>
	public int IsDrawABill { get; set; }

	/// <summary>
	/// 开票记录id
	/// </summary>
	public long? BillRecordId { get; set; }

	/// <summary>
	/// 充值时房间所属业主
	/// </summary>
	public long? OwnerId { get; set; }

	/// <summary>
	/// 应用appid
	/// </summary>
	public string? AppId { get; internal set; }

	/// <summary>
	/// 商户id
	/// </summary>
	public string? MerchantId { get; internal set; }

	/// <summary>
	/// 子商户appid
	/// </summary>
	public string? SubAppId { get; internal set; }

	/// <summary>
	/// 子商户id
	/// </summary>
	public string? SubMerchantId { get; internal set; }

	/// <summary>
	/// 小程序用户openid或支付宝buyerid
	/// </summary>
	public string? OpenId { get; set; }

	/// <summary>
	/// 银行类型
	/// </summary>
	public string? BankType { get; set; }

	/// <summary>
	/// 支付结果描述
	/// </summary>
	public string? TradeStateDescription { get; set; }

	/// <summary>
	/// 支付完成时间
	/// </summary>
	public DateTimeOffset? SuccessTime { get; set; }

	/// <summary>
	/// 支付类型
	/// </summary>
	public string? TradeType { get; set; }

	/// <summary>
	/// 是否是自定义账单，1是
	/// </summary>
	public int? IsCustomBill { get; set; }

	/// <summary>
	/// 账单类别
	/// </summary>
	[SugarColumn(IsJson = true, ColumnDataType = "jsonb", IsNullable = true)]
	public List<CustomBillRecord> Bills { get; set; }

	/// <summary>
	/// 自定账单id
	/// </summary>
	public long? CustomRoomBillId { get; set; }
}
